<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>孟宪文</title>
	</head>
	<body>
	<h1 align="center">学生管理系统-学生列表</h1>
	<table width="1200" border="0" align="center" cellpadding="10">
	  <tr>
	    <td width="614"><div align="right"><a href="reg.html">用户注册</a></div></td>
      </tr>
    </table>
	<table width="1200" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#CCCCCC">
	  <tr>
	    <th width="49" nowrap="nowrap" bgcolor="#FFFFFF" scope="col"><div align="center">ID</div></th>
	    <th width="104" nowrap="nowrap" bgcolor="#FFFFFF" scope="col"><div align="center">用户名</div></th>
	    <th width="110" nowrap="nowrap" bgcolor="#FFFFFF" scope="col"><div align="center">姓名</div></th>
	    <th width="110" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">学号</th>
	    <th width="59" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">性别</th>
	    <th width="92" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">班级</th>
	    <th width="117" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">兴趣</th>
	    <th width="93" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">备注</th>
	    <th width="155" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">注册时间</th>
	    <th width="103" nowrap="nowrap" bgcolor="#FFFFFF" scope="col">操作</th>
      </tr>
<?php
include'conn.php';
$sql = "SELECT * FROM students";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result)>0)
{
	while ($row = mysqli_fetch_assoc($result))
	{
		echo"<tr>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["id"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["uname"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["realname"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["unumber"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".($row["gender"]?"男":"女")."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>网络21-".$row["class"]."班</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["hobby"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".$row["mark"]."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'>".date("Y-m-d H:m",$row["create_time"])."</td>";
		echo"<td align='center' bgcolor='#FFFFFF'><a href='edit.php?id=".$row["id"]."'>编辑</a> <a href='delete.php?id=".$row["id"]."'>删除</a></td>";
		echo"</tr>";
	}	
}
else
{
	echo "<tr><td colspan='10' align='center'>没有记录</td></tr>";
}
$conn->close();
?>

    </table>
</body>
</html>